package func;

public class func {

    public static boolean isNumInArray(int pNum, int[] pArr){
        for(int i=0; i< pArr.length; i++){
            if(pNum==pArr[i]){
                return true;
            }
        }
        return false;
    }

    public static int rand(int num) {
        double random;
        random = Math.random() * (num + 1);
        int rand = (int) random;
        return rand;
    }

    public static String FormattaTempo(long tempo) {
        long ore= tempo/60/60;
        long minuti = tempo / 60;
        long secondi = tempo - 60 * minuti;
        String sec=secondi+"";
        String min=minuti+"";
        String h=ore+"";
        if(sec.length()==1){
            sec="0"+sec;
        }
        if(min.length()==1){
            min="0"+min;
        }
        String ritorna = h+":"+min+":"+sec;
        return ritorna;

    }
        public static long time() {
        long tempo;
        tempo = System.currentTimeMillis() / 1000;
        return tempo;
    }

}
